<template>
  <div id="clothing">
    <el-carousel class="carousel" :interval="4000" height="400px">
      <el-carousel-item>
        <img class="imgL" src="~@/assets/img/img1.jpg" fit="fill"/>
      </el-carousel-item>
      <el-carousel-item>
        <img class="imgL" src="~@/assets/img/img2.jpg" fit="fill"/>
      </el-carousel-item>
      <el-carousel-item>
        <img class="imgL" src="~@/assets/img/img3.jpg" fit="fill"/>
      </el-carousel-item>
      <el-carousel-item>
        <img class="imgL" src="~@/assets/img/img4.jpg" fit="fill"/>
      </el-carousel-item>
      <el-carousel-item>
        <img class="imgL" src="~@/assets/img/img5.jpg" fit="fill"/>
      </el-carousel-item>
    </el-carousel>
    <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
      <el-form-item>
        <el-input v-model="dataForm.designerName" placeholder="设计师名" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="getDataList()">查询</el-button>
      </el-form-item>
    </el-form>
    <!-- <el-table :data="dataList" border v-loading="dataListLoading" style="width: 100%;">
      <el-table-column min-width="200px" label="设计图片" header-align="center" align="center">
        <template slot-scope="scopes">
          <img :src="scopes.row.designerPicture" class="designerPicture">
        </template>
      </el-table-column>
      <el-table-column v-for="row in headerList" :key="row.key" :prop="row.key" :min-width="row.width" :label="row.label" header-align="center" align="center"></el-table-column>
    </el-table> -->
    <div class="clothingBox">
      <div class="clothingItem" v-for="(item, index) in dataList" :key="index">
        <img class="clothingImg" :src="item.designerPicture" alt="">
        <div class="clothingType">服装类型:{{item.dictName}}</div>
        <div class="clothingDesignerName">设计师名:{{item.designerName}}</div>
        <div class="clothingProductAmount">成交价:{{item.productAmount}}元</div>
      </div>
    </div>
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>
  </div>
</template>

<script>
  export default {
    data () {
      return {
        dataForm: {
          designerName: ''
        },
        dataList: [],
        // headerList: [{
        //   key: 'dictName',
        //   label: '服装类型',
        //   width: '150'
        // },
        // {
        //   key: 'productAmount',
        //   label: '成交价(元)',
        //   width: '150'
        // },
        // {
        //   key: 'designerName',
        //   label: '设计师名称',
        //   width: '150'
        // },
        // {
        //   key: 'orderEvaluation',
        //   label: '订单评价',
        //   width: '150'
        // }],
        pageIndex: 1,
        pageSize: 10,
        totalPage: 0,
        dataListLoading: false
      }
    },
    activated () {
      this.getDataList()
    },
    methods: {
      // 获取数据列表
      getDataList () {
        this.dataListLoading = true
        this.$http({
          url: this.$http.adornUrl('/sys/clothingorder/gethistorypage'),
          method: 'get',
          params: this.$http.adornParams({
            'page': this.pageIndex,
            'limit': this.pageSize,
            'designerName': this.dataForm.designerName
          })
        }).then(({ data: res }) => {
          if (res && res.code === 0) {
            this.dataList = res.data.list
            this.totalPage = res.data.totalCount
          } else {
            this.dataList = []
            this.totalPage = 0
          }
          this.dataListLoading = false
        })
      },
      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.getDataList()
      },
      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        this.getDataList()
      }
    }
  }
</script>

<style lang="scss">
.designerPicture{
  width: 200px;
  height: 200px;
  border-radius: 20px;
}
  .clothingBox{
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    overflow: auto;
    .clothingItem{
      border-radius: 5px;
      width: 200px;
      margin-right: 2%;
      height: 300px;
      margin-bottom: 20px;
      text-align: left;
      cursor: pointer;
      .clothingImg{
        height: 60%;
        width: 100%;
      }
      .clothingType{
        font-weight: blod;
        font-size: 16px;
        margin-top: 20px;
        margin-left: 10px;
      }
      .clothingProductAmount{
        color: gray;
        margin-top: 10px;
        margin-left: 10px;
        font-size: 12px;
      }
      .clothingDesignerName{
        font-size: 16px;
        font-weight: bold;
        color: #17B3A3;
        margin: 10px;
      }
    }
    .clothingItem:hover{
      border: 1px solid #17B3A3;
    }
  }
  .imgL{
    width: 100%;
    height: 100%;
  }
</style>
